package com.skeyedu.book.service;


import com.skeyedu.book.entity.Book;
import com.skeyedu.book.mapper.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {

    private static BookMapper bookMapper;

    public List<Book> getBooksOnSelling(){return bookMapper.getBooksOnSelling();}
    public List<Book> getBooksByTitle(String title){return bookMapper.getBooksByTitle("%"+title+"%");}
    public int addBook(Book book){return bookMapper.addBook(book);}

    @Autowired
    public void setBookMapper(BookMapper bookMapper){
        BookService.bookMapper=bookMapper;
    }
}
